<template>
  <div class="face-element-wrapper">
    <img :src="url"/>
  </div>
</template>

<script>
export default {
  name: 'FaceElement',
  props: {
    payload: {
      type: Object,
      required: true
    },
    message: {
      type: Object,
      required: true
    },
  },
  computed:{
    url() {
      let name = ''
      if (this.payload.data.indexOf('@2x') > 0) {
        name = this.payload.data
      } else {
        name = this.payload.data + '@2x'
      }
      return `https://imgcache.qq.com/open/qcloud/tim/assets/face-elem/${name}.png`
    }
  }
}
</script>

<style lang="scss" scoped>
.face-element-wrapper{
  img{
    width: .4rem;
  }
}
</style>
